package com.zixuan.yuojbackendjudgeservice.judge.codesandbox.impl;


import com.zixuan.yuojbackendjudgeservice.judge.codesandbox.CodeSandBox;
import com.zixuan.yuojbackendjudgeservice.judge.codesandbox.model.ExecuteCodeRequest;
import com.zixuan.yuojbackendjudgeservice.judge.codesandbox.model.ExecuteCodeResponse;
import com.zixuan.yuojbackendmodel.model.codesandbox.JudgeInfo;
import com.zixuan.yuojbackendmodel.model.enums.JudgeInfoMessageEnum;
import com.zixuan.yuojbackendmodel.model.enums.QuestionSubmitStatusEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * @author Mr.Mei
 * @date 2023/11/14
 */
@Slf4j
public class ExampleCodeSandBox implements CodeSandBox {

    @Override
    public ExecuteCodeResponse executeSandBox(ExecuteCodeRequest requestCodeSandBox) {
        log.info("ExampleCodeSandBox");
        List<String> inputList = requestCodeSandBox.getInputList();
        ExecuteCodeResponse responseCodeSandBox = new ExecuteCodeResponse();
        responseCodeSandBox.setMessage("成功");
        responseCodeSandBox.setStatus(QuestionSubmitStatusEnum.SUCCEED.getValue());
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setMemory(100L);
        judgeInfo.setTime(100L);
        responseCodeSandBox.setJudgeInfo(judgeInfo);
        responseCodeSandBox.setOutputList(inputList);
        return responseCodeSandBox;
    }
}
